<!doctype html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>T L 知识付费系统</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="{{ url_for('static',filename='css/font.css') }}">
    <link rel="stylesheet" href="{{ url_for('static',filename='css/style.css') }}">
    <link rel="stylesheet" href="{{ url_for('static',filename='css/theme.css') }}">
    <link rel="stylesheet" href="{{ url_for('static',filename='lib/font-awesome-4.7.0/css/font-awesome.min.css') }}">
</head>
<body class="index">
<div class="container">
    <div class="logo">
        <a href="{{ url_for('sys_bp.main_frame') }}" target="content">T L CMS知识付费系统</a>
    </div>
    <ul class="nav_center">
        {% if current_user.is_authenticated %}
            <li><a href="{{ url_for('sys_bp.main_frame') }}" target="content"><i class="fa fa-home fa-lg"></i> 后台首页</a></li>
        {% endif %}
        <li><a href="{{ url_for('sys_bp.member_list') }}" target="content"><i class="fa fa-flag-o fa-lg"></i> 系统管理</a></li>
        <li><a href="{{ url_for('sys_bp.connector') }}" target="content"><i class="fa fa-exchange fa-lg"></i> 接口管理</a></li>
        <li><a href="{{ url_for('sys_bp.tool') }}" target="content"><i class="fa fa-cube fa-lg"></i> 站长工具</a></li>
        <li><a href="{{ url_for('sys_bp.email_send') }}" target="content"><i class="fa fa-at fa-lg"></i> 发送邮件</a></li>
        <li><a href="{{ url_for('sys_bp.templates_theme') }}" target="content"><i class="fa fa-magic fa-lg"></i> 系统模板</a></li>
        <li><a id="verifyAuthorization" target="content"><i class="fa fa-key fa-lg"></i> 系统授权</a></li>
    </ul>
    <ul class="layui-nav right">
        <li class="layui-nav-item">
            <a href="javascript:;">
                {% if current_user.is_authenticated %}
                    欢迎 {{ current_user.username or '非法用户!' }} 访问管理系统 !
                {% endif %}
            </a>
        </li>
        <li class="layui-nav-item"><a class="empty_Cache">清除缓存</a></li>
        <li class="layui-nav-item"><a target="_blank" href="{{ url_for('webapp_bp.index_page') }}">前台首页</a></li>
        <li class="layui-nav-item"><a target="content" id="userExit">注销登录</a></li>

    </ul>
</div>
<a href="{{ url_for('sys_bp.logout') }}" hidden="hidden" id="exit_url"></a>
<script type="text/javascript" src="{{ url_for('static',filename='js/jquery.min.js') }}"></script>
<script>
    $(function () {
        $('.empty_Cache').on('click', function () {
            $.ajax({
                url: "{{ url_for('sys_bp.emptyCache') }}",
                dataType: "json",
                type: "POST",
                success: function (data) {
                    if (data.status === 0) {
                        parent.window.frames["content"].layer.open({title: 'TL-CMS提示', content: '缓存清除成功!'});
                    } else {
                        parent.window.frames["content"].layer.open({title: 'TL-CMS提示', content: '缓存清除失败!'});
                    }
                }, error: function () {
                    parent.window.frames["content"].layer.open({title: 'TL-CMS提示', content: '缓存清除异常!'});
                }
            });

        });
        $('#userExit').click(function () {
            parent.window.frames["content"].layer.confirm('您确定要离开后台么?', {
                btn: ['离开', '后悔了'],
                btnAlign: 'c'
                , yes: function (index, layero) {
                    ele = $('#userExit');
                    ele.attr('href', "{{ url_for('sys_bp.logout') }}");
                    ele[0].click()
                }, btn2: function (index, layero) {
                    //取消
                    parent.window.frames["content"].layer.msg('小鬼, 还知道会回来!', {icon: 6, time: 2000});
                }
            })

        });
        $('#verifyAuthorization').on('click', function () {
            $.get('{{ url_for("sys_bp.validation_authorization") }}', function (data) {
                if (data.status !== 0) {
                    parent.window.frames["content"].layer.prompt({title: '输入授权码，并确认', formType: 1}, function (val, index) {
                        $.ajax({
                            type: 'SELECT',
                            url: '{{ url_for("sys_bp.tl_sys_validation_authorization") }}',
                            data: {"auth_code": val},
                            dataType: "json",
                            success: function (data) {
                                if (data.status === 0) {
                                    parent.window.frames["content"].layer.msg(data.msg, {icon: 1});
                                    setTimeout(function () {
                                        parent.window.frames["content"].layer.close(index);
                                    }, 1000);
                                } else {
                                    parent.window.frames["content"].layer.msg(data.msg, {icon: 5});
                                }
                            }, error: function () {
                                parent.window.frames["content"].layer.msg('授权操作失败!', {icon: 5});
                            }
                        })
                    });
                } else {
                    parent.window.frames["content"].layer.msg('系统已授权,无需授权!')
                }
            });

        })
    });
</script>
</body>
</html>